//
//  ViewController.m
//  28_AutoLayoutAnimation
//
//  Created by 徐昊 on 16/8/22.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *backImageView;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *centerY;
@property (weak, nonatomic) IBOutlet UIButton *buttonAnimation;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout150;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *layout20;

@end

@implementation ViewController
- (IBAction)comeback:(id)sender {
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    //    self.layout150.priority = 751;
    //    self.layout20.priority = 750;
    [UIView animateWithDuration:5 animations:^{
        [self.view layoutIfNeeded];
    }];
}
- (IBAction)startAnimation:(id)sender {
//    // 改变centerY的constant
//    self.centerY.constant = -200;
//    // 执行动画效果
//    [UIView animateWithDuration:1 animations:^{
//        // 必须调用 layoutIfNeeded
//        [self.view layoutIfNeeded];
//        
//    }];5
    // 约束的优先级, 改变时, 主要注意不能为1000, 程序会崩溃
    // 同一约束优先级高的背会执行, 优先级低的会被忽略
    self.layout20.priority = 751;
    self.layout150.priority = 750;
    [UIView animateWithDuration:5 animations:^{
        
        [self.view layoutIfNeeded];
    }];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
